package com.anjie.powerproject.service.impl;

import com.anjie.powerproject.repository.PreDataHourRepository;
import com.anjie.powerproject.service.PreDataHourService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class PreDataHourServiceImpl implements PreDataHourService {
    @Autowired
    PreDataHourRepository preDataHourRepository;
    @Override
    public int[] getPreDataHourValueByCodeAndDateAndGraphIdAndType(String date, String deviceCode, Integer graphId, Integer stgyType) {
        List<BigDecimal> datas=preDataHourRepository.getPreDataHourValueByCodeAndDateAndGraphIdAndType(date,deviceCode,graphId,stgyType);


        int[] res=new int[datas.size()];
        for(int i=0;i<datas.size();i++){
            res[i]=datas.get(i).intValue();
        }
        System.out.println(res);

        return res;
    }
}
